#!/bin/sh

# $Id: initramfs.cfg,v 1.3 2009-08-10 08:38:58 brian Exp $
# Copyright (c)2009 Brian Manning
# elspicyjack (at) gmail dot com
# PLEASE DO NOT E-MAIL THE AUTHOR ABOUT THIS SOFTWARE
# The proper venue for questions is the LACK mailing list at:
# http://groups.google.com/group/linuxack or <linuxack@groups.google.com>

# License: GPL v2 (see licence blurb at the bottom of the file)

# this is a simple script that has nothing but shell variables; this file is
# sourced by make_initramfs.sh in order to set up the build environment for
# making an initramfs image

### set up variables used by different files/scripts
INITRAMFS_CFG_VERSION=2
KERNEL_VER="3.6.9-lack"
PROJECT_NAME="xlack"
# for the issue file
RELEASE_DATE=$(/bin/date +%d%b%Y)
RELEASE_VER="2012.4 (${RELEASE_DATE})"
LACK_PASS="dawson32nd"
GIT=$(which git)
PERL_GTK2_SRC="/dev/shm/perl-Gtk2"

# export some stuff so other scripts can use it
export KERNEL_VER PROJECT_NAME RELEASE_DATE RELEASE_VER LACK_PASS

RECIPES='
    _basedirs _baselibs.squeeze udev.squeeze
    debug-tools lspci.squeeze usbutils lshw libstdc++.squeeze
    pam.squeeze pam.locales
    lsb-base openssl wget mount-tools.squeeze
    xfs lvm2.squeeze e2fsprogs extfs-common
    dhclient sudo ncursesw.squeeze dialog.squeeze mpg123.squeeze
    shellinabox libasound.squeeze aumix alsa-utils.squeeze
    perl.xlack.squeeze
    perl.datetime.squeeze perl.ui-dialog
    perl.gtk2.squeeze gtk2libs.squeeze imagelibs.squeeze
    xserver-core.squeeze xserver-input.squeeze xserver-video.squeeze
    x11libs.squeeze x11data.squeeze
    xserver-utils.squeeze xserver-bin.squeeze xserver-xkb.squeeze
    xroot-toys cpp.squeeze
    libstdc++.squeeze xwm-windowlab
    fontconfig ttf-dejavu-core
    xfonts-terminus.xlack xfonts.xlack
    xterm
    gtk2-perl-examples.xlack gtk-chtheme
    gtk2-engines gtk2-engines-cleanice 
    gtk2-engines-murrine gtk2-engines-nodoka
    gtk2-engines-pixbuf gtk2-engines-sapwood
    gtk2-engines-wonderland gtk2-engines-xfce
    gtk2-engines-nodoka-rojo.xlack
' # RECIPES
    # gtk2-engines-magicchicken <-- not in squeeze, in testing
    # gtk2-engines-ubuntulooks
    # xfonts-misc.squeeze all of the misc fonts
    # perl.squeeze perl-base.squeeze perl-modules.squeeze
    # mrxvt  
    
# a list of files that will be mangled prior to being stuffed into $TEMP_DIR
INPUT_FILES="
    etcfiles/issue.${PROJECT_NAME}
    etcfiles/issue.${PROJECT_NAME}.nogetty
    isolinux/${PROJECT_NAME}.banner.txt
" # INPUT_FILES

    # source the common build functions (used below)
    echo "- Sourcing common_release_functions located in ${BUILD_BASE}/scripts"
    source $BUILD_BASE/scripts/common_release_functions.sh

    # script-y type things
    # from make_initramfs.sh; sets OUTPUT_FILENAME
    if [ "x${LACK_WORK_DIR}" = "x" ]; then
        export LACK_WORK_DIR="/tmp"
    fi
    find_first_free_filename $LACK_WORK_DIR \
        "initramfs-${PROJECT_NAME}-${KERNEL_VER}"

    # grab the Gtk2-Perl source from git
    sync_perl_gtk2_source $PERL_GTK2_SRC
    check_exit_status $? "Syncing Perl-Gtk2 source to ${PERL_GTK2_SRC}"
    # copy the LACK SSL PEM file for shellinabox
    copy_lack_ssl_pem_file
    check_exit_status $? "Copying LACK SSL PEM key/cert file"
    # check the project filelist has been set by make_initramfs.sh
    check_empty_envvar "PROJECT_LIST" $PROJECT_LIST
    check_exit_status $? "PROJECT_LIST environment variable"
    # check the temp directory has been set by make_initramfs.sh
    check_empty_envvar "TEMP_DIR" $TEMP_DIR
    check_exit_status $? "TEMP_DIR environment variable"
    # check that the *.base.txt file exists for this project
    check_base_file_exists
    check_exit_status $? "${PROJECT_DIR}/${PROJECT_NAME}.base.txt file exists"
    # create the project filelist
    create_project_filelist
    check_exit_status $? "Create project filelist"
    # create the hostname file, put it in the temp dir
    create_hostname_file
    check_exit_status $? "Creating hostname file"
    # we want a standalone init script for pigwidgeon
    create_init_initramfs_script
    check_exit_status $? "Creating initramfs init script"
    # copy the busybox binary
    copy_busybox_binary
    check_exit_status $? "Copying busybox binary"
    # run INPUT_FILES through a sed filter
    sedify_input_files $INPUT_FILES
    check_exit_status $? "Applying 'sed' filters to input files"

# *begin licence blurb*
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA  02111-1307 USA

# vi: set filetype=sh shiftwidth=4 tabstop=4:
# fin!
